<template>
  <div class="footer">
    <van-tabbar route>
      <van-tabbar-item replace to="/home" icon="home-o">
        首页
      </van-tabbar-item>
      <van-tabbar-item replace to="/taskmanage" icon="friends-o">
        提现
      </van-tabbar-item>
      <van-tabbar-item replace to="/PJ_task" icon="comment-o">
        额外任务
      </van-tabbar-item>
      <van-tabbar-item replace to="/PJing" :badge="templateId" icon="comment-o">
        评价任务
      </van-tabbar-item>
      <van-tabbar-item replace :to="footer" icon="orders-o">
        任务进度
      </van-tabbar-item>
      <van-tabbar-item replace to="/mine" icon="user-o">
        我的
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import {evaluate_list} from "../api/api";

export default {
  data() {
    return {
      templateId: "",
      taskClass: window.localStorage.getItem('xfq_task_class'),
      footer: "/taskdetail",
      taba:[],
      page:1,
      page_size:20,
    }
  },
  methods:{
    getPJlist(){
      let params = {
        page:this.page,
        page_size:this.page_size,
      }
      evaluate_list(params).then((res)=>{
        console.log(res);
        if(res.Status == 200){
          res.Data.forEach((item)=>{
               if(item.status == 1){
                  this.taba.push(item)
               }
          })
          if(this.taba.length==0){
            this.taba = null
          }
        this.templateId = this.taba.length
          console.log(this.taba.length);
        }else{
          this.taba = null
        }
      })
    }
  },
  mounted() {
    this.getPJlist()
    if (this.taskClass == 'pdd') {
      this.footer = '/dd_details'
    } else if (this.taskClass == 'dy') {
      this.footer = '/dy_details'
    } else {
      this.footer = '/taskdetail'
    }
  },
}
</script>

<style lang="stylus">
.footer {
  width 100%
  position fixed
  z-index 999
  bottom 0
}
</style>


